#pragma once
#include "cv_canvas.hpp"
#include "line_segment2d.h"
#include "polygon2d.h"

using namespace geometry;



// 用于绘制geometry_calculation中定义的几何数据类型
class CanvasNew : public cvCanvas
{
public:
    CanvasNew(cvCanvas::cvCanvasParam &param) : cvCanvas(param) {}
    CanvasNew() : cvCanvas() {}
    void AddVec2d(Vec2d vec2d_p, cv::Scalar color = cv::Scalar(0, 0, 0), int thickness = 1)
    {
        AddPoint(Pose2D(vec2d_p.x(), vec2d_p.y(), 0), color, thickness);
    }
    void AddLineSegment2d(LineSegment2d segment, cv::Scalar color = cv::Scalar(0, 0, 0), int thickness = 1)
    {
        AddLine(Pose2D(segment.start().x(), segment.start().y(), 0),
                Pose2D(segment.end().x(), segment.end().y(), 0), color, thickness);
    }
    void AddPolygon2d(Polygon2d poly, cv::Scalar color = cv::Scalar(0, 0, 0), int thickness = 1)
    {
        std::vector<Pose2D> Poses;
        for (auto const &vec2d_p : poly.points()) {
            Poses.push_back(Pose2D(vec2d_p.x(), vec2d_p.y(), 0));
        }
        AddPolygon(Poses, color, thickness);
    }

private:
};

const cv::Scalar CV_RED(0, 0, 255);
const cv::Scalar CV_ORANGE(0, 127, 255);
const cv::Scalar CV_YELLOW(0, 255, 255);
const cv::Scalar CV_GREEN(0, 255, 0);
const cv::Scalar CV_GREEN_DARK(0, 122, 0);
const cv::Scalar CV_BLUE(255, 0, 0);
const cv::Scalar CV_PURPLE(255, 0, 127);
const cv::Scalar CV_MAGENTA(255, 0, 255);
const cv::Scalar CV_BLACK(0, 0, 0);
const cv::Scalar CV_WHITE(255, 255, 255);
const cv::Scalar CV_BROWN(0, 75, 150);
const cv::Scalar CV_LIGHTGREY(192, 192, 192);
const cv::Scalar CV_GREY(127, 127, 127);
const cv::Scalar CV_DARKGREY(64, 64, 64);
const cv::Scalar CV_CYAN(0, 255, 255);
const cv::Scalar CV_LIME(0, 255, 127);
const cv::Scalar CV_AQUA(255, 127, 0);
const cv::Scalar CV_TEAL(127, 127, 0);
const cv::Scalar CV_PINK(203, 192, 255);
